package com.youpai.platform.wallet.web.api;

import com.youpai.platform.common.entity.resp.BaseResponse;
import com.youpai.platform.wallet.service.service.WalletService;
import com.youpai.platform.wallet.web.entity.dto.WalletLogDTO;
import com.youpai.platform.wallet.web.entity.req.QueryWalletLogReq;
import com.youpai.platform.wallet.web.entity.resp.GetWalletInfoResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @date: 2023/2/15
 * @author: Welles
 * @version: 1.0
 * @description: 钱包controller
 */
@Slf4j
@RestController
@RequestMapping(value = "/wallet")
@Api(value = "WalletController", tags = "钱包相关")
public class WalletController {

    @Resource
    private WalletService walletService;

    @ApiOperation(value = "充值")
    @PostMapping(value = "/info/get")
    public BaseResponse<GetWalletInfoResp> getWalletInfo() {
        return BaseResponse.success(walletService.getWalletInfo());
    }

    @ApiOperation(value = "查询账户日志")
    @PostMapping(value = "/log/query")
    public BaseResponse<List<WalletLogDTO>> queryWalletLog(@RequestBody QueryWalletLogReq req) {
        return BaseResponse.success(walletService.queryWalletLog(req));
    }
}
